package beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

/**
 *
 * @author Marcelo Neto
 */
@ManagedBean(name="unidadesFederativasBean")
@ViewScoped
public class UnidadesFederativasBean implements Serializable 
{
    private static final long serialVersionUID = 8886723006026897638L;
    private List<SelectItem> uf = new ArrayList<>();
    private List<String> ufs = new ArrayList<>();
    private List<String> ufso = new ArrayList<>();
    
    public List<SelectItem> getUf() 
    {
        if (this.uf == null)
        {
            this.uf = new ArrayList<>();
            this.uf.add(new SelectItem("AC", "Acre"));
            this.uf.add(new SelectItem("AL", "Alagoas"));
            this.uf.add(new SelectItem("AM", "Amazonas"));
            this.uf.add(new SelectItem("AP", "Amapá"));
            this.uf.add(new SelectItem("BA", "Bahia"));
            this.uf.add(new SelectItem("CE", "Ceará"));
            this.uf.add(new SelectItem("DF", "Distrito Federal"));
            this.uf.add(new SelectItem("ES", "Espírito Santo"));
            this.uf.add(new SelectItem("GO", "Goiás"));
            this.uf.add(new SelectItem("MA", "Maranhão"));
            this.uf.add(new SelectItem("MG", "Minas Gerais"));
            this.uf.add(new SelectItem("MS", "Mato Grosso do Sul"));
            this.uf.add(new SelectItem("MT", "Mato Grosso"));
            this.uf.add(new SelectItem("PA", "Pará"));
            this.uf.add(new SelectItem("PB", "Paraíba"));
            this.uf.add(new SelectItem("PE", "Pernambuco"));
            this.uf.add(new SelectItem("PI", "Piauí"));
            this.uf.add(new SelectItem("PR", "Paraná"));
            this.uf.add(new SelectItem("RJ", "Rio de Janeiro"));
            this.uf.add(new SelectItem("RN", "Rio Grande do Norte"));
            this.uf.add(new SelectItem("RO", "Rondonia"));
            this.uf.add(new SelectItem("RR", "Roraima"));
            this.uf.add(new SelectItem("RS", "Rio Grande do Sul"));
            this.uf.add(new SelectItem("SC", "Santa Catarina"));
            this.uf.add(new SelectItem("SE", "Sergipe"));
            this.uf.add(new SelectItem("SP", "São Paulo"));
            this.uf.add(new SelectItem("TO", "Tocantins"));
        }
        return uf;
    }

    public void setUf(List<SelectItem> uf) {
        this.uf = uf;
    }
    
    /* Exemplo
    public List<SelectItem> getListarDescricao() 
    {
        List<SelectItem> descricoes = new ArrayList<>();
        SetorRN setorRN = new SetorRN();
        List<Setor> resultado = setorRN.listarSetorDescricao();
        for (Setor nome : resultado) {
            SelectItem item = new SelectItem(nome.getDescricaoSetor());
            descricoes.add(item);
        }
        return descricoes;
    }
    */

    public List<String> getUfs() 
    {
        this.ufs.add("AC - Acre");
        this.ufs.add("AL - Alagoas");
        this.ufs.add("AM - Amazonas");
        this.ufs.add("AP - Amapá");
        this.ufs.add("BA - Bahia");
        this.ufs.add("CE - Ceará");
        this.ufs.add("DF - Distrito Federal");
        this.ufs.add("ES - Espírito Santo");
        this.ufs.add("GO - Goiás");
        this.ufs.add("MA - Maranhão");
        this.ufs.add("MG - Minas Gerais");
        this.ufs.add("MS - Mato Grosso do Sul");
        this.ufs.add("MT - Mato Grosso");
        this.ufs.add("PA - Pará");
        this.ufs.add("PB - Paraíba");
        this.ufs.add("PE - Pernambuco");
        this.ufs.add("PI - Piauí");
        this.ufs.add("PR - Paraná");
        this.ufs.add("RJ - Rio de Janeiro");
        this.ufs.add("RN - Rio Grande do Norte");
        this.ufs.add("RO - Rondonia");
        this.ufs.add("RR - Roraima");
        this.ufs.add("RS - Rio Grande do Sul");
        this.ufs.add("SC - Santa Catarina");
        this.ufs.add("SE - Sergipe");
        this.ufs.add("SP - São Paulo");
        this.ufs.add("TO - Tocantins");
        return ufs;
    }

    public void setUfs(List<String> ufs) {
        this.ufs = ufs;
    }

    public List<String> getUfso() 
    {
        this.ufso.add(0, "AC - Acre");
        this.ufso.add(1, "AL - Alagoas");
        this.ufso.add(2, "AM - Amazonas");
        this.ufso.add(3, "AP - Amapá");
        this.ufso.add(4, "BA - Bahia");
        this.ufso.add(5, "CE - Ceará");
        this.ufso.add(6, "DF - Distrito Federal");
        this.ufso.add(7, "ES - Espírito Santo");
        this.ufso.add(8, "GO - Goiás");
        this.ufso.add(9, "MA - Maranhão");
        this.ufso.add(10, "MG - Minas Gerais");
        this.ufso.add(11, "MS - Mato Grosso do Sul");
        this.ufso.add(12, "MT - Mato Grosso");
        this.ufso.add(13, "PA - Pará");
        this.ufso.add(14, "PB - Paraíba");
        this.ufso.add(15, "PE - Pernambuco");
        this.ufso.add(16, "PI - Piauí");
        this.ufso.add(17, "PR - Paraná");
        this.ufso.add(18, "RJ - Rio de Janeiro");
        this.ufso.add(19, "RN - Rio Grande do Norte");
        this.ufso.add(20, "RO - Rondonia");
        this.ufso.add(21, "RR - Roraima");
        this.ufso.add(22, "RS - Rio Grande do Sul");
        this.ufso.add(23, "SC - Santa Catarina");
        this.ufso.add(24, "SE - Sergipe");
        this.ufso.add(25, "SP - São Paulo");
        this.ufso.add(26, "TO - Tocantins");
        return ufso;
    }

    public void setUfso(List<String> ufso) {
        this.ufso = ufso;
    }
}